//
//  LikeGiftTableViewCell.m
//  礼物说
//
//  Created by dllo on 16/5/4.
//  Copyright © 2016年 sunzhichao. All rights reserved.
//

#import "LikeGiftTableViewCell.h"

@interface LikeGiftTableViewCell ()

@property (nonatomic, retain) BaseImageView * imgView;
@property (nonatomic, retain) BaseLabel * nameLabel;
@property (nonatomic, retain) BaseLabel * priceLabel;
@property (nonatomic, retain) BaseLabel * label;

@end

@implementation LikeGiftTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createCell];
    }
    return self;
}
- (void)dealloc{
    
    [_label release];
    [_model release];
    [_imgView release];
    [_priceLabel release];
    [_nameLabel release];
    [super dealloc];
}
- (void)setModel:(LiWu *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.pictrue] placeholderImage:PLACEHOLDER_IMAGE];
    
    _priceLabel.text = _model.price;
    _nameLabel.text = _model.name;
}
- (void)createCell{
    
    self.imgView = [[BaseImageView alloc] initWithFrame:CGRectMake(kWIDTHS(10), kWIDTHS(5), kWIDTHS(80), kHEIGHTS(80))];
    [self.contentView addSubview:_imgView];
    _imgView.layer.cornerRadius = 10;
    _imgView.layer.masksToBounds = YES;
    [_imgView release];
    
    
    self.nameLabel = [[BaseLabel alloc] initWithFrame:CGRectMake(kWIDTHS(120), kWIDTHS(5), kWIDTHS(200), kHEIGHTS(50))];
    _nameLabel.numberOfLines = 0;
    [self.contentView addSubview:_nameLabel];
    [_nameLabel release];
    
    
    self.label = [[BaseLabel alloc] initWithFrame:CGRectMake(kWIDTHS(200), kWIDTHS(55), kWIDTHS(60), kWIDTHS(25))];
    [self.contentView addSubview:_label];
    [_label release];
    
    _label.text = @"价格：";
    _label.textColor = [UIColor redColor];
    
    self.priceLabel = [[BaseLabel alloc] initWithFrame:CGRectMake(kWIDTHS(260), kWIDTHS(55), kWIDTHS(200 - 80), kWIDTHS(25))];
    [self.contentView addSubview:_priceLabel];
    [_priceLabel release];
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
